<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateMoneyChangesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('money_changes', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('advertiser')->comment('公司id');
            $table->string('contract_id')->comment('合同id');
            $table->integer('product_line')->comment('产品线');
            $table->tinyInteger('type')->comment('1充值 3分配款 4 退款 5转款');
            $table->integer('account_id')->comment('相关账户id');
            $table->date('pay_date')->comment('开始时间')->nullable();
            $table->integer('rebate')->comment('返点')->default(0);
            $table->decimal('money')->comment('金额')->nullable();
            $table->decimal('show_money')->comment('显示金额')->nullable();
            $table->tinyInteger('pay_type')->comment('付款方式 1预付 2垫付')->default(1);
            $table->text('note')->comment('备注')->nullable();
            $table->decimal('cost_money')->comment('实付金额');
            $table->decimal('arrears')->comment('欠额');
            $table->decimal('balance')->comment('余额');
            $table->integer('flow_id')->comment('审批流id')->nullable();
            $table->integer('order_id')->comment('审批步骤排序id')->default(1);
            $table->integer('flow_user_id')->comment('流程审批人id')->nullable();
            $table->integer('submituser')->comment('提交人');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('money_changes');
    }
}
